package com.share.wechat.fristpage.vo;

import org.springframework.util.StringUtils;

import java.util.ArrayList;

/**
 * 返回前段消息的对象
 * Created by yujl on 2018/1/16.
 */
public class ReturnResult {
    // 200 代表正常 其他值代表有错误
    private Integer code;
    /**
     * 返回该消息的提示信息
     */
    private String msg;

    /**
     * 返回当前所需的封装的数据
     */
    private Object data;


    public Integer getCode() {
        if (code == null) {
            return 200;
        }
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        if (StringUtils.isEmpty(msg)) {
            return "success";
        }
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        if (data == null) {
            return new ArrayList<>();
        }
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
